package cn.com.qingz.core.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * @ClassName: ContextLoaderListener
 * @author jiulong.hu
 * @date 2013-12-28 下午12:01:30
 * 
 */
public class ContextLoaderListener extends
		org.springframework.web.context.ContextLoaderListener {
	private static Log log = LogFactory.getLog(ContextLoaderListener.class);
	
	public void contextInitialized(ServletContextEvent event) {
		 super.contextInitialized(event);
		 ServletContext context = event.getServletContext();  
		 String contextName = context.getContextPath();   
	 	 try {
	 		context.setAttribute("ctx",contextName);
		 } catch (Exception e) {
			  log.error("--------------------设置全局变量异常-----------------",e);
		 }
	}
}
